<!DOCTYPE html>
<html>
<!--
Copyright 2010 The Closure Library Authors. All Rights Reserved.

Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<title>Closure - All JsUnit Tests</title>
<script src="third_party/closure/closure/goog/base.js"></script>
<script>

var _allTests = [
  'bind_attribute_parser_test.html',
  'element_bindings_test.html',
  'element_model_test.html',
  'dependency_parser_test.html',
  'expression_parser_test.html',
  'html5_attributes_test.html',
  'model_test.html',
  'path_test.html',
  'place_holder_parser_test.html',
  'template_element_test.html',
  'transform_test.html',
  'platform/dom_mutation_test.html',
  'platform/dom_observe_test.html',
  'platform/observers_test.html',
  'util/view_controller_test.html',
];

// Conditionally add tests that depend on Proxy support.
if (window.Proxy) {
  _allTests.push('platform/forwarding_handler_test.html',
                 'platform/object_observe_test.html');
}

</script>
<script>
goog.require('goog.userAgent.product');
goog.require('goog.testing.MultiTestRunner');
</script>
<link rel="stylesheet" href="third_party/closure/closure/goog/css/multitestrunner.css">
<style>
h1 {
  font: normal x-large arial, helvetica, sans-serif;
  margin: 0;
}
p, form {
  font: normal small sans-serif;
  margin: 0;
}
#header {
  position: absolute;
  right: 10px;
  top: 13px;
}
#footer {
  margin-top: 8px;
}
a {
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
.warning {
  font-size: 14px;
  font-weight: bold;
  width: 80%;
}
</style>
</head>
<body>

<script>
  if (goog.userAgent.product.CHROME &&
      window.location.toString().indexOf('file:') == 0) {
    document.write(
        '<div class="warning">' +
        'WARNING: Due to Chrome\'s security restrictions ' +
        'this test will not be able to load files off your local disk ' +
        'unless you start Chrome with:<br>' +
        '<code>--allow-file-access-from-files</code></div><br>');
  }
</script>

<h1>Closure - All JsUnit Tests</h1>
<p id="header">
  <a href="http://wiki/Main/ClosureUnitTests">Closure JS Testing HOWTO</a>
</p>
<div id="runner"></div>
<!--  Use a form so browser persists input values -->
<form id="footer" onsubmit="return false">
  Settings:<br>
  <input type="checkbox" name="hidepasses" id="hidepasses" checked>
  <label for="hidepasses">Hide passes</label><br>
  <input type="checkbox" name="parallel" id="parallel" checked>
  <label for="parallel">Run in parallel</label>
  <small>(timing stats not available if enabled)</small><br><br>
  <label for="filter">Only run tests that match:</label><br>
  <input type="text" name="filter" id="filter" value="">
  <small>(use regexp, e.g. "structs.*")</small>
</form>
<script>
  if (typeof _allTests == 'undefined') {
    document.write(
        '<p>No testfiles detected.  Ensure you have generated the ' +
        'test dependencies and the test sources:<br>' +
        '<code>' +
        'blaze build javascript/closure:alltests' +
        '</code></p>');

  } else {
    var hidePassesInput = document.getElementById('hidepasses');
    var parallelInput = document.getElementById('parallel');
    var filterInput = document.getElementById('filter');

    function setFilterFunction() {
      var matchValue = filterInput.value || '.*';
      var re;
      try {
        re = new RegExp(matchValue);
      } catch (e) {
        alert(e.message);
        setTimeout(function() {
          filterInput.select();
        }, 0);
        return;
      }
      testRunner.setFilterFunction(function(testPath) {
        return re.test(testPath);
      });
    }

    // Create a test runner and render it.
    var testRunner = new goog.testing.MultiTestRunner()
        .setName(document.title)
        .setPoolSize(parallelInput.checked ? 8 : 1)
        .setStatsBucketSizes(5, 500)
        .setHidePasses(hidePassesInput.checked)
        .setVerbosePasses(true)
        .addTests(_allTests);
    testRunner.render(document.getElementById('runner'));

    goog.events.listen(hidePassesInput, 'click', function(e) {
      testRunner.setHidePasses(e.target.checked);
    });

    goog.events.listen(parallelInput, 'click', function(e) {
      testRunner.setPoolSize(e.target.checked ? 8 : 1);
    });

    goog.events.listen(filterInput, 'blur', setFilterFunction);
    setFilterFunction();
  }
</script>
</body>
</html>
